<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><%= @title ? "#{@title} - #{APP_CONFIG['site_title']}": APP_CONFIG['site_title'] %></title>
    <meta name="description" content="<%= @description || APP_CONFIG['site_description'] %>">
    <meta name="author" content="Robbin Fan">
    <link href="/rss" rel="alternate" title="<%= APP_CONFIG['site_title'] %>" type="application/rss+xml" />
    <%= stylesheet_link_tag '/skins/default/document', '/skins/default/content' %>
    <%= yield_content :stylesheets %>
  </head>
  <body>
    <div id="flash-notice"></div>
    <div class="header">
      <div class="wrap">
      	<div class="user_img"><img src="/skins/data/100.png" width="80" height="80" alt="website icon"></div>
        <div class="blog_title"><%= APP_CONFIG['site_title'] %></div>
        <div class="write">
        <% unless account_login? -%>
          <%= link_to '登录', url(:login) -%>
        <% else -%>
          <%= current_account.name -%>
          <% if account_admin? -%>
          <%= link_to '写文章', url(:admin, :new_blog) -%>
          <%= link_to '管理', url(:admin, :index), :class => 'admin' -%>
          <% end -%>
          <%= button_to '退出', url(:logout), :method => :delete -%>
        <% end -%>
        </div>
        <div class="blog_motto"><%= APP_CONFIG['site_motto'] %></div>
      </div>
    </div><!-- header -->
    
    <div class="nav">
      <div class="wrap clearfix">
      	<div class="search fr">
          <form action="/search" id="cse-search-box" method="get">
            <input type="hidden" name="cx" value="<%= APP_CONFIG['google_cse'] %>" />
            <input type="hidden" name="cof" value="FORID:10" />
            <input type="hidden" name="ie" value="UTF-8" />
            <input id="search-box" name="q" type="text" placeholder="Search" value="<%= params[:q] %>">
            <button id="search-button"></button>
          </form>
        </div>
        <ul>
          <li><a href="/" <%= "class='current'".html_safe if @nav == 'home' %>>首页</a></li>
          <li><a href="/blog" <%= "class='current'".html_safe if @nav == 'blog' %>>博客</a></li>
          <li><a href="/note" <%= "class='current'".html_safe if @nav == 'note' %>>笔记</a></li>
          <li><a href="/tag" <%= "class='current'".html_safe if @nav == 'tag' %>>分类</a></li>
          <li><a href="/weibo" <%= "class='current'".html_safe if @nav == 'weibo' %>>微博</a></li>
          <li><a href="<%= APP_CONFIG['show_me_url'] %>" <%= "class='current'".html_safe if @nav == 'me' %>>关于</a></li>
        </ul>
      </div>
    </div><!-- nav -->
    
    <div class="wrap clearfix">
      <%= yield %>
    </div><!-- content -->
    
    <div class="footer">
    	<a href="http://weibo.com/robbinfan" class="weibo">Weibo</a>
      <a href="https://github.com/robbin" class="github">Github</a>      
      <a href="mailto:fankai@gmail.com" class="mail">Email</a>
      <% if APP_CONFIG['show_certification'] %>
      <div class="certification">
        <span>京ICP备13004925号-1</span><span>京公网安备11010502023235号</span>
      </div>
      <% end %>
      <div class="powered-by">
        <a href="http://robbinfan.com" title="robbin的自言自语">Powered by robbin</a>
      </div>
    </div><!-- footer -->
    <%= javascript_include_tag 'jquery', 'jquery-ujs', 'application' %>
    <%= yield_content :javascripts %>
    <% if flash[:notice] %>
      <script type="text/javascript">
        $('div#flash-notice').html('<%= flash[:notice] %>').show().fadeOut(3000);
      </script>
    <% end %>
  </body>
</html>